using System;

namespace PropertyExpression.TypedSqlBuilder.Test
{
    public static class SalesOrderHeaderExtensions
    {
        public static IValue<DateTime> OrderDate(this IRow<SalesOrderHeader> it)
        {
            return it._(_ => _.OrderDate);
        }

        public static IValue<int> SalesOrderID(this IRow<SalesOrderHeader> it)
        {
            return it._(_ => _.SalesOrderID);
        }

        public static IValue<int> CustomerID(this IRow<SalesOrderHeader> it)
        {
            return it._(_ => _.CustomerID);
        }
    }

    public static class SalesOrderDetailExtensions
    {
        public static IValue<int> SalesOrderID(this IRow<SalesOrderDetail> it)
        {
            return it._(_ => _.SalesOrderID);
        }

        public static IValue<int> SpecialOfferID(this IRow<SalesOrderDetail> it)
        {
            return it._(_ => _.SpecialOfferID);
        }

        public static IValue<int> ProductID(this IRow<SalesOrderDetail> it)
        {
            return it._(_ => _.ProductID);
        }

    }

    public static class SpecialOfferProductExtensions
    {
        public static IValue<int> SpecialOfferID(this IRow<SpecialOfferProduct> it)
        {
            return it._(_ => _.SpecialOfferID);
        }

        public static IValue<int> ProductID(this IRow<SpecialOfferProduct> it)
        {
            return it._(_ => _.ProductID);
        }
    }

    public static class SpecialOffertExtensions
    {
        public static IValue<int> SpecialOfferID(this IRow<SpecialOffer> it)
        {
            return it._(_ => _.SpecialOfferID);
        }
    }

    public static class ProductExtensions
    {
        public static IValue<int> ProductID(this IRow<Product> it)
        {
            return it._(_ => _.ProductID);
        }

        public static IValue<string> Name(this IRow<Product> it)
        {
            return it._(_ => _.Name);
        }
    }

    public static class IndividualExtensions
    {
        public static IValue<int> CustomerID(this IRow<Individual> it)
        {
            return it._(_ => _.CustomerID);
        }

        public static IValue<int> ContactID(this IRow<Individual> it)
        {
            return it._(_ => _.ContactID);
        }
    }

    public static class ContactExtensions
    {
        public static IValue<int> ContactID(this IRow<Contact> it)
        {
            return it._(_ => _.ContactID);
        }

        public static IValue<string> FirstName(this IRow<Contact> it)
        {
            return it._(_ => _.FirstName);
        }
    }

    public static partial class Schema
    {
        public static ITable<SalesOrderHeader> SalesOrderHeaders
        {
            get { return Query.Table<SalesOrderHeader>(); }
        }

        public static ITable<SalesOrderDetail> SalesOrderDetails
        {
            get { return Query.Table<SalesOrderDetail>(); }
        }

        public static ITable<SpecialOfferProduct> SpecialOfferProducts
        {
            get { return Query.Table<SpecialOfferProduct>(); }
        }

        public static ITable<SpecialOffer> SpecialOffers
        {
            get { return Query.Table<SpecialOffer>(); }
        }

        public static ITable<Product> Products
        {
            get { return Query.Table<Product>(); }
        }

        public static ITable<Individual> Individuals
        {
            get { return Query.Table<Individual>(); }
        }

        public static ITable<Contact> Contacts
        {
            get { return Query.Table<Contact>(); }
        }
    }
}
